package org.tio.sitexxx.service.service.gl;

import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.SqlPara;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.sitexxx.service.cache.CacheConfig;
import org.tio.sitexxx.service.cache.Caches;
import org.tio.sitexxx.service.model.main.Consultant;
import org.tio.sitexxx.service.model.main.Payment;
import org.tio.sitexxx.service.vo.Const;
import org.tio.utils.cache.CacheUtils;
import org.tio.utils.cache.FirsthandCreater;
import org.tio.utils.cache.ICache;

import java.util.List;
import java.util.Map;

public class ConsultantManageService {

    private static Logger log	= LoggerFactory.getLogger(ConsultantManageService.class);
    public static final ConsultantManageService	me	= new ConsultantManageService();

    /**
     * 返回顾问列表
     * @param pageNumber
     * @param pageSize
     * @return
     */
    public Page<Record> ConsultantList(int pageNumber, int pageSize){
        String db = Const.Db.TIO_SITE_MAIN;
        String sqlid = "gl_consultant.list";
        SqlPara sqlPara = Db.use(db).getSqlPara(sqlid);
        return Db.paginate(pageNumber, pageSize,sqlPara);
    }

    /**
     * 根据顾问id查找方案
     * @param id
     * @param pageNumber
     * @param pageSize
     * @return
     */
    public Page<Record> getDesignByConsultantid(int id,int pageNumber,int pageSize){
        String db = Const.Db.TIO_SITE_MAIN;
        String sqlid = "gl_design.getDesignListByConsultantId";
        Kv kv = Kv.by("consultantId",id);
        SqlPara sqlPara = Db.use(db).getSqlPara(sqlid,kv);
        Page<Record> payments = Db.paginate(pageNumber,pageSize,sqlPara);
        return payments;
    }

    /**
     * 顾问完成的（客服）订单列表
     * @param id
     * @param pageNumber
     * @param pageSize
     * @return
     */

    public Page<Payment> kfPaymentListByConsultant(int id,int pageNumber,int pageSize){
        String db = Const.Db.TIO_SITE_MAIN;
        String sqlid = "gl_payment.kfPaymentListByConsultant";
        Kv kv = Kv.by("consultantId",id);
        SqlPara sqlPara = Db.use(db).getSqlPara(sqlid,kv);
        return Payment.dao.paginate(pageNumber,pageSize,sqlPara);
    }


}
